<%
	Response.AddHeader "pragma","no-cache"
	Response.AddHeader "cache-control","private"

	bMadonvi=Request("bMadonvi")
	if bMadonvi="" then
		bMadonvi=Session("bMaDonVi")
	end if

%>
<!--#include file="..\CheckSession.inc"-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tim kiem</title>
<body topmargin=0 leftmargin=0 bgcolor=#F8F9D9>
	<form name=frm method=post action="search.asp?bSearch=ok&bMadonvi=<%=bMadonvi%>">
		<table width=100% border=0>
			<tr>
				<td width=70%>
                <input name=Txt style="font-family:times new roman;width:100%" size="20"></td>
				<td width=30%><input name=Cmd value=Search Type=submit style="font-family:times new roman;width:100%"></td>
			</tr>
		</table>		
<%
			'if right(bMadonvi,2)<>"00" then
			'	strMadonvi=" madonvi ='"& bMadonvi &"'  "
			'else
			'	if bMadonvi="000000" then
			'		strMadonvi=" macanbo=macanbo  "	
			'	else
			'		strMadonvi=" madonvi like '"& left(bMadonvi,4) &"%'  "
			'	end if
			'end if

			strMadonvi=" madonvi ='"& bMadonvi &"'  "

			if request("bSearch")="ok" then	
				btxt=Request("Txt")
				sSQL="Select * from canbo where hovaten like '%"& bTxt &"%' and " & strMadonvi &" order by stt1,stt2,stt3,ten,hovaten"
			else
				sSQL="Select * from canbo where " & strMadonvi &" order by stt1,stt2,stt3,ten,hovaten"				 
			end if

			Set RecTC=Server.CreateObject("ADODB.Recordset")
			RecTC.CursorType=3
			RecTC.CacheSize=5
			RecTC.Open sSQL,Conn
%>
				<select ondblclick="javaScript:doSelect()" size="8" name="List" style="font-family: times new roman; width: 100%; border-style: solid; border-width: 1; padding-left: 0; background-color: #FFFFFF; height:280">
<%
			Do While not RecTC.EOF
%>
		<option value="<%=trim(RecTC("Hovaten"))%>_ID<%=RecTC("macanbo")%>"><%=trim(RecTC("hovaten"))%></option>
<%
				RecTC.movenext
			Loop
%>
		</select>
	</form>
</body>
<script language=javascript>
function doSelect() {
	var sValue;
	sValue = document.forms[0].List.value;
	if ("" + sValue != "") {
		window.close();
		if (window.opener) { 
			window.opener.document.frmnoidung.Canbo.value=sValue; 
			window.opener.focus();
		}
	}
}	
    </script>